package net.wanho.controller;

import lombok.RequiredArgsConstructor;
import net.wanho.dto.ProductDTO;
import net.wanho.service.ProductService;
import net.wanho.vo.PageInfo;
import net.wanho.vo.ProductVo;
import net.wanho.vo.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Author：汤小洋
 * Date：2024-10-23 10:35
 * Description：<描述>
 */
@RestController
@RequestMapping("/product")
@RequiredArgsConstructor
public class ProductController {

    private final ProductService productService;

    @GetMapping("/product-page-list")
    public R productPageList(@RequestParam(defaultValue = "1") int pageNum,
                             @RequestParam(defaultValue = "5") int pageSize,
                             ProductDTO productDTO){
        PageInfo<ProductVo> pageInfo = productService.pageList(pageNum, pageSize, productDTO);
        return R.success(pageInfo);
    }
}
